<template>
  <view class="outBox">
    <u-navbar leftText="竞价成功" leftIconColor="#fff" :autoBack="true" bgColor="#242331">
      <view class="left-slot" slot="left">
         <u-icon name="arrow-left" color="#fff"></u-icon>
        <text>竞价成功</text>
      </view>
    </u-navbar>
    <view class="content" :style="{
			marginTop:menuHeight + 'px',
		}">
      <view class="sucImg">
        <image src="@/static/order/sucIcon.png" mode="widthFix"></image>
        <text>竞价成功</text>
      </view>
      <view class="itemBox">
        <view class="tit">
          <text>预定信息</text>
        </view>
        <view class="info">
          <view class="table">
            <text>{{curTable.counterNo}}</text>
          </view>
          <view class="text">
            <text>{{curTime}}</text>
          </view>
        </view>
      </view>
      <view class="btn" @click="backHome">
        <text>返回首页</text>
      </view>
    </view>
  </view>
</template>

<script>
import {
  getWXStatusHeight
} from '@/utils/index.js'

export default {
  data() {
    return {
      // 胶囊的宽度
      barWidth: 0,
      menuHeight: 0,
      // 支付类型 1一口价 2 竞价
      type: 1,
      // 当前日期
      curTime: '',
      curTable: {},
      orderInfo: {},
    }
  },
  onLoad(e) {
    let obj = getWXStatusHeight()
    this.barWidth = obj.barWidth + 3
    this.menuHeight = obj.menuHeight
    this.type = e.type

    this.initData()
  },
  methods: {
    backHome(){
      uni.switchTab({
        url:'/pages/home/index'
      })
    },
    // 初始化数据
    initData() {
      this.curTime = this.getFormattedDate()
      this.curTable = uni.getStorageSync('curTable')
      this.orderInfo = uni.getStorageSync('orderInfo')
    },
    // 获取时间
    getFormattedDate(date = new Date()) {
      let year = date.getFullYear();
      let month = (`0${date.getMonth() + 1}`).slice(-2); // 月份是从0开始的，所以+1，并且保证两位数
      let day = (`0${date.getDate()}`).slice(-2); // 保证日期是两位数
      let weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
      let weekDay = weekDays[date.getDay()];

      return `${year}-${month}-${day} ${weekDay}`;
    }
  }
}
</script>

<style lang="scss" scoped>
.sucImg{
  margin: 100rpx 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text{
    text-align: center;
    font-size: 50rpx;
    font-weight: bolder;
    color: #fff;
  }
  image{
    width: 150rpx;
    margin-bottom: 40rpx;
  }
}
.tit {
  margin-bottom: 20rpx;

  text {
    color: #f3f3f3;
    font-size: 34rpx;
  }
}

.btn {
  text-align: center;
  background-color: #76a834;
  border-radius: 20rpx;
  line-height: 80rpx;

  text {
    font-size: 36rpx;
    color: #fff;
    letter-spacing: 8rpx;
  }
}

.itemBox {
  background-color: #2f2e2c;
  padding: 30rpx;
  margin-bottom: 30rpx;

  .info {
    display: flex;

    .table {
      border: 1rpx solid #fff;
      background-color: #76a834;
      width: 200rpx;
      height: 100rpx;
      border-radius: 10rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 40rpx;

      text {
        color: #fff;
        font-size: 36rpx;
        text-align: center;
      }
    }

    .text {
      color: #fff;
      font-size: 28rpx;
      display: flex;
      flex-direction: column;
      justify-content: space-between;

      text {
        &:nth-child(2) {
          color: #76a834;
        }
      }
    }
  }
}

.content {
  position: relative;
  padding: 20rpx 40rpx;
  box-sizing: border-box;
  min-height: calc(100vh - 40rpx);
}

.left-slot {
  color: #fff;

  image {
    width: 40rpx;
    margin-right: 30rpx;
  }
}

.outBox {
  background-color: #242331;
}
</style>
